# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Content.V21.Model.ServiceStoreConfigCutoffConfig do
  @moduledoc """
  Time local delivery ends for the day based on the local timezone of the store. `local_cutoff_time` and `store_close_offset_hours` are mutually exclusive.

  ## Attributes

  *   `localCutoffTime` (*type:* `GoogleApi.Content.V21.Model.ServiceStoreConfigCutoffConfigLocalCutoffTime.t`, *default:* `nil`) - Time in hours and minutes in the local timezone when local delivery ends.
  *   `noDeliveryPostCutoff` (*type:* `boolean()`, *default:* `nil`) - Merchants can opt-out of showing n+1 day local delivery when they have a shipping service configured to n day local delivery. For example, if the shipping service defines same-day delivery, and it's past the cut-off, setting this field to `true` results in the calculated shipping service rate returning `NO_DELIVERY_POST_CUTOFF`. In the same example, setting this field to `false` results in the calculated shipping time being one day. This is only for local delivery.
  *   `storeCloseOffsetHours` (*type:* `String.t`, *default:* `nil`) - Represents cutoff time as the number of hours before store closing. Mutually exclusive with other fields (hour and minute).
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :localCutoffTime =>
            GoogleApi.Content.V21.Model.ServiceStoreConfigCutoffConfigLocalCutoffTime.t() | nil,
          :noDeliveryPostCutoff => boolean() | nil,
          :storeCloseOffsetHours => String.t() | nil
        }

  field(:localCutoffTime,
    as: GoogleApi.Content.V21.Model.ServiceStoreConfigCutoffConfigLocalCutoffTime
  )

  field(:noDeliveryPostCutoff)
  field(:storeCloseOffsetHours)
end

defimpl Poison.Decoder, for: GoogleApi.Content.V21.Model.ServiceStoreConfigCutoffConfig do
  def decode(value, options) do
    GoogleApi.Content.V21.Model.ServiceStoreConfigCutoffConfig.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Content.V21.Model.ServiceStoreConfigCutoffConfig do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
